#ifndef SERVER_H
#define SERVER_H

#include <QWidget>
#include <QTcpServer>
#include <QTcpSocket>
#include <QMap>
#include "ui_chatwindow.h"
class Server : public QTcpServer
{
    Q_OBJECT
public:
    explicit Server(QObject *parent = nullptr);
protected:
    //处理新连接
    void incomingConnection(qintptr socketDescriptor) override;

signals:
    void newClientConnected(QTcpSocket *client);
private slots:
    void handleReadyRead(QTcpSocket *client);


private:
    QMap<QString,QTcpSocket*> m_clients;

};

#endif // SERVER_H
